package com.iplant.aps.service;

import com.iplant.aps.service.po.OutResult;
import com.iplant.aps.service.po.Pagination;
import com.iplant.aps.service.po.ServiceResult;
import com.iplant.aps.service.po.andon.FocasLGL;
import com.iplant.aps.service.po.aps.*;
import com.iplant.aps.service.po.bfc.BFCMessage;
import com.iplant.aps.service.po.bms.BMSEmployee;
import com.iplant.aps.service.po.excel.ExcelData;
import com.iplant.aps.service.po.fmc.FMCLine;
import com.iplant.aps.service.po.fmc.FMCWorkCharge;
import com.iplant.aps.service.po.fpc.FPCPart;
import com.iplant.aps.service.po.fpc.FPCPartPoint;
import com.iplant.aps.service.po.fpc.FPCProduct;
import com.iplant.aps.service.po.fpc.FPCRoutePart;
import com.iplant.aps.service.po.oms.OMSCheckMsg;
import com.iplant.aps.service.po.oms.OMSOrder;
import com.iplant.aps.service.po.rsm.RSMTurnOrderDesc;
import com.iplant.aps.service.po.sfc.SFCBOMTask;
import com.iplant.aps.service.po.sfc.SFCBOMTaskItem;
import com.iplant.aps.service.po.wms.*;

import java.util.Calendar;
import java.util.List;
import java.util.Map;

public interface MyHelperService {

    /**
     * 获取修程Name映射
     *
     * @param wLoginUser 登陆者
     * @return Key：修程Name Value：修程
     */
    ServiceResult<Map<String, FMCLine>> FMC_QueryLineNameMap(BMSEmployee wLoginUser);

    /**
     * 获取工位Name映射
     */
    ServiceResult<Map<String, FPCPart>> FPC_QueryPartNameMap(BMSEmployee wLoginUser);

    /**
     * 获取工序Name映射
     */
    ServiceResult<Map<String, FPCPartPoint>> FPC_QueryPartPointNameMap(BMSEmployee wLoginUser);

    /**
     * 查询工位 班组映射
     */
    ServiceResult<Map<Integer, FMCWorkCharge>> FMC_QueryWorkChargeMap(BMSEmployee wLoginUser);

    /**
     * 获取产品型号映射
     *
     * @param wLoginUser 登陆者
     * @return Key:产品型号名称 Value:产品型号
     */
    ServiceResult<Map<String, FPCProduct>> FPC_QueryProductNameMap(BMSEmployee wLoginUser);

    /**
     * 查询工区检验员映射
     */
    ServiceResult<Map<Integer, List<Integer>>> LFS_QueryWorkAreaCheckListMap(BMSEmployee wLoginUser);

    /**
     * 根据订单、工位获取上工位ID集合
     *
     * @param wLoginUser 登录人
     * @param wOrderID   订单ID
     * @param wStationID 工位ID
     */
    ServiceResult<List<Integer>> FPC_QueryPreStationIDList(BMSEmployee wLoginUser, int wOrderID, int wStationID);

    /**
     * 判断某个工序任务是否能进行派工
     *
     * @param wLoginUser 登录者
     * @return 判断结果
     */
    ServiceResult<Boolean> SFC_JudgeTaskStepIsCanDo(BMSEmployee wLoginUser, APSTaskStep wAPSTaskStep);

    /**
     * 判断是否发起返修
     */
    ServiceResult<Boolean> WDW_IsSendRepair(BMSEmployee wAdminUser, int taskID, int iPTItemID);

    List<FocasLGL> Focas_LGLMES(BMSEmployee wLoginUser, int wYear);

    WMSReturn WMS_PostLL(WMSLinePartLLs wWMSLinePartLLs, WMSPickDemand wPickDemand);

    WMSReturn WMS_SynchronizTime(WMSLinePartLLs wWMSLinePartLLs, WMSPickDemand wPickDemand);

    WMSReturn WMS_PostLL(WMSLinePartLLs wWMSLinePartLLs, WMSBatchPickDemand wPickDemand);

    WMSReturn WMS_PostTL(WMSLinePartTLs wWMSLinePartTLs, MESMaterialReturn wData, OMSOrder wOrder);

    void WMS_TestSend();

    /**
     * 领料取消
     */
    WMSReturn WMS_PostLLCancel(WMSPickDemand wWMSPickDemand);

    WMSReturn WMS_PostLLCancel(WMSBatchPickDemand wWMSBatchPickDemand);

    /**
     * 推送委外拆修入库需求
     */
    WMSReturn WMS_MPSDisassembly(WMSSubRepairReceipts wWMSSubRepairReceipts, WMSPickDemand wPickDemand);

    WMSReturn WMS_MPSDisassembly_1(WMSSubRepairReceipts wWMSSubRepairReceipts, WMSPickDemand wPickDemand);

    ServiceResult<Integer> WMS_TriggerSelfRepairPartsWarehousingTask(BMSEmployee wLoginUser, APSTaskStep wAPSTaskStep);

    ServiceResult<List<WMSPickDemand>> WMS_QueryEmployeeAll_SelfTask(BMSEmployee wLoginUser, int wTagType,
                                                                     Calendar wStartTime, Calendar wEndTime);

    ServiceResult<Integer> WMS_SelfTaskApplyInstock(BMSEmployee wLoginUser, WMSPickDemand wWMSPickDemand);

    ServiceResult<String> WMS_ShowZXQRCode(BMSEmployee wLoginUser, int wWMSPickDemandID);

    ServiceResult<Integer> WMS_ZXJDisassembly(BMSEmployee wLoginUser, int wDemandID);

    ServiceResult<Integer> WMS_SelfTaskCodeScanningHandover(BMSEmployee wLoginUser, String wDemandNo);

    ServiceResult<List<OMSOrder>> OMS_QueryPlanMainList(BMSEmployee wLoginUser, int wProductID, int wLineID,
                                                        int wCustomerID, int wOrderID, Calendar wStartTime,
                                                        Calendar wEndTime, int wAPSShiftPeriod);

    ServiceResult<List<APSTaskPart>> APS_QueryMonthPlanByMonthNew(BMSEmployee wLoginUser, int wProductID, int wLineID
            , int wCustomerID, int wOrderID, int wAreaID, int wPartID, int wAPSShiftPeriod, Calendar wStartTime,
                                                                  Calendar wEndTime);

    ServiceResult<List<OMSOrder>> OMS_QueryHistoryOrderListNew(BMSEmployee wLoginUser, Calendar wStartTime,
                                                               Calendar wEndTime, int wAPSShiftPeriod);

    ServiceResult<List<APSDayPlanMain>> APS_QueryDayPlanMainList(BMSEmployee wLoginUser, Calendar wStartTime,
                                                                 Calendar wEndTime, int wProductID, int wLineID,
                                                                 int wCustomerID, int wOrderID, int wAreaID,
                                                                 int wPartID,
                                                                 int wStatus);

    ServiceResult<List<APSTaskStep>> APS_QueryDayPlanDetails(BMSEmployee wLoginUser, int wOrderID, int wPartID);

    ServiceResult<List<WMSPickDemandItem>> WMS_QueryPickDemandList(BMSEmployee wLoginUser, int wOrderID, int wPartID,
                                                                   int wPartPointID);

    ServiceResult<List<SFCBOMTaskItem>> SFC_QuerySFCBOMTaskList(BMSEmployee wLoginUser, int wOrderID, int wPartID,
                                                                int wPartPointID);

    ServiceResult<List<OMSCheckMsg>> OMS_Check_V2(BMSEmployee wLoginUser, String wOrderIDs);

    ServiceResult<List<OMSCheckMsg>> OMS_QueryCheckMsgList(BMSEmployee wLoginUser, int wType, int wPlanTaskID);

    ServiceResult<Integer> OMS_UpdateCheckMsg(BMSEmployee wLoginUser, OMSCheckMsg wOMSCheckMsg);

    ServiceResult<Integer> OMS_UpdateCheckMsgList(BMSEmployee wLoginUser, List<OMSCheckMsg> wOMSCheckMsgList);

    ServiceResult<List<FPCRoutePart>> FPC_QueryStationDetails(BMSEmployee wLoginUser, int wOrderID,
                                                              int wAPSShiftPeriod);

    ServiceResult<List<RSMTurnOrderDesc>> RSM_QueryTurnOrderDescList(BMSEmployee wLoginUser, int wOrderID,
                                                                     int wPartID, int wPartPointID,
                                                                     int wIsMaterialShortage);

    ServiceResult<Integer> RSM_UpdateTurnOrderDesc(BMSEmployee wLoginUser, RSMTurnOrderDesc wRSMTurnOrderDesc);

    ServiceResult<List<WMSPickDemandItem>> WMS_QueryPickDemandItemList(BMSEmployee wLoginUser, int wOrderID,
                                                                       int wPartID, int wPartPointID, String wMaterial);

    void WMS_CancelPickDemandListByFinishedOrder(BMSEmployee wLoginUser, OMSOrder wOrder,
                                                 OutResult<Integer> wErrorCode);

    ServiceResult<Integer> WMS_AgreeReSendPickDemandList(BMSEmployee wLoginUser,
                                                         List<WMSPickDemand> wWMSPickDemandList, int wIsAgree);

    ServiceResult<List<APSTaskStep>> QueryDayPlanDetailsByOrder(BMSEmployee wLoginUser, int wOrderID);

    ServiceResult<Integer> APS_UpdatePlanDate(BMSEmployee wLoginUser, int wOrderID, int wPartID, int wPartPointID,
                                              Calendar wPlanStartTime, Calendar wPlanEndTime);

    ServiceResult<Integer> APS_ComponentAutoFinish(BMSEmployee wLoginUser, String wOrderIDs);

    ServiceResult<Integer> WMS_CancelAllFinished(BMSEmployee wLoginUser);

    ServiceResult<APSTaskPart> APS_QueryTaskPart(BMSEmployee wLoginUser, int wOrderID, int wPartID);

    ServiceResult<APSTaskStep> APS_QueryTaskStep(BMSEmployee wLoginUser, int wOrderID, int wPartID, int wPartPointID);

    ServiceResult<Integer> WMS_CancelAllFinishedByIDs(BMSEmployee wLoginUser, String wIDs);

    ServiceResult<List<APSTaskStep>> QueryOrderBOP(BMSEmployee wLoginUser, int wOrderID, int wPartID,
                                                   int wPartPointID, String wDutyPerson, String wCheckName,
                                                   String wStatusString, Pagination wPagination);

    ServiceResult<String> APS_ExportOrderBOP(BMSEmployee wLoginUser, List<APSTaskStep> wAPSTaskStepList);

    ServiceResult<Integer> WMS_UpdatePickDemand(BMSEmployee wLoginUser, WMSPickDemand wWMSPickDemand);

    ServiceResult<Integer> WMS_SynchronizeExpectTime(BMSEmployee wLoginUser);

    ServiceResult<Integer> WMS_SynchronizeExpectTimeByTaskPartList(BMSEmployee wLoginUser,
                                                                   List<APSTaskPart> wAPSTaskPartList);

    ServiceResult<List<Integer>> WMS_QueryExportIDList(BMSEmployee wLoginUser, String wOrderType,
                                                       String wOrderTypeNot, String wDemandNo, int wProductID,
                                                       int wLineID, int wCustomerID, String wOrderID, int wPartID,
                                                       String wMaterial, int wStatus, Calendar wStartTime,
                                                       Calendar wEndTime, int wSourceType, String wSourceTypeNot,
                                                       int wSendStatus, Calendar wPreSendStartDate,
                                                       Calendar wPreSendEndDate, int wIsFinish);

    ServiceResult<Integer> WMS_SynchronizTimeNotClose(BMSEmployee wLoginUser);

    ServiceResult<List<FPCRoutePart>> FPC_QueryRoutePartListByRouteID(BMSEmployee wLoginUser, int wRouteID);

    ServiceResult<List<BFCMessage>> WMS_QueryTechMessageList(BMSEmployee wLoginUser, int wTagType, int wModuleID,
                                                             Calendar wStartTime, Calendar wEndTime);

    ServiceResult<Integer> WMS_CompletedClose(BMSEmployee wLoginUser, String wDemandIDs);

    ServiceResult<Integer> APS_ResetTaskPart(BMSEmployee wLoginUser, int wTaskPartID);

    ServiceResult<List<WMSPickDemandItem>> WMS_QueryPickDemandItemListByCondition(BMSEmployee wLoginUser,
                                                                                  int wProductID, int wLineID,
                                                                                  int wCustomerID, int wOrderID,
                                                                                  int wPartID, int wPartPointID,
                                                                                  String wMaterial, String wDemandNo,
                                                                                  int wUpdateFlag,
                                                                                  Calendar wStartTime,
                                                                                  Calendar wEndTime,
                                                                                  Pagination wPagination);

    ServiceResult<Integer> WMS_PickDemandItemReSendFails(BMSEmployee wLoginUser, int wProductID, int wLineID,
                                                         int wCustomerID, int wOrderID, int wPartID, int wPartPointID
            , String wMaterial, String wDemandNo, int wUpdateFlag, Calendar wStartTime, Calendar wEndTime);

    ServiceResult<List<APSBomBPMItem>> APS_ImportItem(BMSEmployee wLoginUser, ExcelData wExcelData);

    ServiceResult<Integer> APS_SynchronizeExpectTime(BMSEmployee wLoginUser, int wAPSBPMID);

    ServiceResult<Integer> WMS_SendDemandsByOrderAndPart(BMSEmployee wLoginUser, String wOrderIDs, String wPartIDs,
                                                         String wStepIDs);

    ServiceResult<Integer> WMS_SendByMaterialNumber(BMSEmployee wLoginUser, int wOrderID, int wPartID, int wStepID,
                                                    int wMaterialID);

    void APS_SynchronizeNotMainTaskPartDate(BMSEmployee wLoginUser, int wOrderID);

    ServiceResult<Integer> APS_SynchronizePlanTime(BMSEmployee wLoginUser, int wOrderID);

    ServiceResult<Integer> WMS_TestSynchronizeSendDate(BMSEmployee wLoginUser, int wTaskPartID);

    ServiceResult<Integer> WMS_CancelOutDemand(BMSEmployee wLoginUser, int wDemandID);

    ServiceResult<Integer> WMS_TriggerPickDemandByPrevAndDisa(BMSEmployee wLoginUser, int wOrderID,
                                                              List<Integer> wPartIDList, List<Integer> wMaterialIDList);

    void CreateSFCOutMaterialTrackLedgerList(BMSEmployee wLoginUser, WMSPickDemand wPickDemand);

    ServiceResult<Integer> WMS_ReRecoilInstockLine(BMSEmployee wLoginUser, int wDemandID, int wDemandItemID,
                                                   int wDemandItemStockID);

    ServiceResult<Integer> WMS_ReCreateRecoilPickDemand(BMSEmployee wLoginUser, int wDemandID, String wDemandItemIDs);

    ServiceResult<Integer> WMS_DeleteCancelledShipping(BMSEmployee wLoginUser, String wDemandIDs);

    ServiceResult<List<APSTaskStep>> APS_QueryTaskStepByTimeNew_V2(BMSEmployee wLoginUser, Calendar wStartTime
            , Calendar wEndTime, int wAreaID, int wOrderID, Pagination wPagination);

    ServiceResult<SFCBOMTask> SFC_QueryBOMTaskDetailData(BMSEmployee wLoginUser, int wBOMTaskID, int wStepID);

    ServiceResult<List<APSBOMItem>> APS_QueryCarBOMByOrderAndStationList(BMSEmployee wLoginUser, int wOrderID,
                                                                         String wStationList);

    ServiceResult<Integer> SFC_AutoConfirmBOMTask(BMSEmployee wLoginUser, int wSFCBomTaskID);

    ServiceResult<Integer> SFC_AutoCloseBOMTask(BMSEmployee wLoginUser);

    /**
     * 自动发送计划至中央控制系统
     */
    void APS_AutoSendPlanToCentralControl();

    ServiceResult<Integer> APS_SendPlanToCentralControl(BMSEmployee wLoginUser, String wTaskStepIDs);

    ServiceResult<Integer> WMS_UpdateWorkSpace(BMSEmployee wLoginUser, String wPartNo, int wWorkSpaceID);

    ServiceResult<List<APSBomBPMItem>> APS_QueryBomItemList(BMSEmployee wLoginUser, String wCode, int wProductID, int wLineID, int wCustomerID, int wOrderID, String wWBSNo, int wPartID, int wPartPointID, String wMaterialName, String wMaterialNo, int wStatus, int wSAPStatus, int wReplaceType, int wOutSourceType, int wOperationType, Calendar wStartTime, Calendar wEndTime);

    /**
     * 创建反冲料领料需求
     */
    ServiceResult<Integer> WMS_CreateRecoilDemand(BMSEmployee wLoginUser, int wOrderID, int wPartID, int wStepID,int wTaskStepID);
}
